/**
 * List里面常用的属性和方法：
 *  常用属性：
 *    length 长度
 *    reversed 翻转
 *    isEmpty 是否为空
 *    isNotEmpty 是否不为空
 *  常用方法：
 *    add  增加
 *    addAll 拼接数组
 *    indexOf 查找 传入具体值
 *    remove 删除 传入具体值
 *    removeAt 删除 传入具体值
 *    fillRange 修改
 *    insert(index,value); 指定位置插入
 *    insertAll(index,list); 指定位置插入List
 *    toList() 其他类型转换成List
 *    join() List转换成字符串
 *    split() 字符串转化成List
 *    forEach
 *    map
 */
void main(List<String> args) {
  var l1 = ['香蕉', '苹果', '西瓜'];
  print(l1);
  print(l1.isEmpty);
  print(l1.isNotEmpty);
  print(l1.reversed);

  var newMyList = l1.reversed.toList();
  print(newMyList);
  l1.add('桃子');
  l1.addAll(['葡萄', '荔枝']);
  print(l1);
  print(l1.indexOf("苹果1"));

  var str = l1.join("-");
  print(str);
  var list = str.split('-');
  print(list);

  List myList = ['香蕉', '苹果', '西瓜', '香蕉', '苹果', '西瓜'];
  print(myList);
  var s1 = new Set();
  s1.addAll(myList);
  print(s1);
  print(s1.toList());

  for (int i = 0; i < myList.length; i++) {
    print(myList[i]);
  }

  print("********item");
  for (var item in myList) {
    print(item);
  }
  print("*****foreach");
  myList.forEach((element) {
    print(element);
  });

  List myList1 = [1, 3, 4, 5, 7, 8, 9];
  // List newList = new List();
  var newList = myList1.map((e) => e * 2);
  print(newList.toList());
  var newListWhere = myList1.where((element) => element > 5);
  print(newListWhere);
  var f = myList1.any((element) => element > 5);
  print(f);
  var v = myList1.every((element) => element > 5);
  print(v);
  
}
